#include "odn_game_Level.h"

namespace ouden
{
	namespace game
	{
		
		//Read the map file header 
		virtual void ODN_Level::readDataHeader()
		{
			
			//Read the map file identifier string and check it 
			std::string MapFileIDString = "00000000";
			readData(&MapFileIDString[0]);
			if (MapFileIDString != MAP_FILE_ID_STRING) {
				std::cout << "Map file ID string was incorrect, could not load" << std::endl;
			}
			
			//Read the map format and map specific version information
			readData(&versioninfo.Map.MajorVersion); readData(&versioninfo.Map.MinorVersion);
			readData(&versioninfo.Map.MajorRevision); readData(&versioninfo.Map.MinorRevision);
			readData(&versioninfo.Format.MajorVersion); readData(&versioninfo.Format.MinorVersion);
			readData(&versioninfo.Format.MajorRevision); readData(&versioninfo.Format.MinorRevision);
			
			//Read the checksum value 
			readData(&checksum);
			
		}
		
		//Read a section of the map file 
		virtual void ODN_Level::processDataSection(sSectionHeader SectionHeader)
		{
			
			//All of the different sections within a level file 
			enum eSectionIDs { 
				ID_SpawnPoints=0,
				ID_Points,
				ID_Edges,
				ID_Polygons,
				//more 
			};
			
			switch(SectionHeader.SectionID) {
				
				case (ID_SpawnPoints) : 
					
					
					
					break;
					
				case (ID_Points) : 
					
					WORD HowMany;
					readData(&HowMany);
					points.resize(HowMany);
					readDataArray(&points[0], HowMany);
					
					break;
					
			}
			
		}
		
	} //namespace game 
} //namespace ouden 
